<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>discussionItem</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="icon" href="/images/icon.jpg">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script src="/js/jquery-2.1.4.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/discussionItem.css">

</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="/index.html" class="navbar-brand logo">
                <img src="/images/icon.jpg" width="50px" alt="">
            </a>
            <a class="navbar-brand" href="/index.html">
                <span>义启行</span>
            </a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="/index.html">首页<span class="sr-only">(current)</span></a></li>
                <li><a href="#">Link</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="/discussion.html">讨论</a></li>
                <li class="publish"><a href="/publish.html">分享</a></li>
                <li><a href="/recruit.html" class="recruitTab" style="display: none;">发布招募</a></li>
                <li class="authTab"><a href="/login.html">登录</a></li>
                <li class="authTab"><a href="/register.html">注册</a></li>
                <li class="dropdown user" style="display: none">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        <span>
                            <span>
                                <img class="avatarUrl img-circle" src="/images/adorable.jpg" alt="">
                            </span>
                            <span class="nickname"></span>
                        </span>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <input type="hidden" value="-1" class="role">
                        <li><a href="/personal.html">个人信息</a></li>
                        <li><a href="/replies.html">回复我的</a></li>
                        <li><a href="/signupInfo.html">报名信息</a></li>
                        <li><a href="/logout">退出登录</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-8">
            <div class="page-header">
                <h1>
                    <span class="title">这是标题</span>
                    <span class="pull-right">
                        <small><span class="glyphicon glyphicon-time modifiedAt">2020-04-11</span></small>
                        <small> <span class="glyphicon glyphicon-heart likeCount">10</span></small>
                        <small><span class="glyphicon glyphicon-eye-open readCount">100</span></small>
                        <small><span class="glyphicon glyphicon-tag classification">经验分享</span></small>
                    </span>
                </h1>
            </div>
            <div class="media">
                <div class="media-left">
                    <a href="#">
                        <img class="media-object img-circle DIAvatarUrl" src="/images/c3.webp" alt="...">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                        <input type="hidden" class="DIUserId">
                        <span class="DINickname">liyuan</span>
                        <small>Lv<span class="DILevel">3</span></small>
                    </h4>
                    <p class="DIDescription">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci amet
                        architecto at beatae cupiditate ducimus earum eius expedita illo magni maxime molestiae nesciunt
                        pariatur qui quibusdam quidem, quo ratione vitae!
                    </p>
                </div>
            </div>
        </div>
        <div class="col-md-2"></div>
    </div>
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-8">
            <div id="show-view">
                <textarea style="display:none;" class="content">
                    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias animi commodi, eos esse, illum minima officia perferendis possimus qui quibusdam rem saepe. Aliquam commodi fugit quod rerum vero! Beatae, perferendis.
                </textarea>
            </div>
            <script>
                window._bd_share_config = {
                    "common": {
                        "bdSnsKey": {},
                        "bdText": "",
                        "bdMini": "2",
                        "bdMiniList": false,
                        "bdPic": "",
                        "bdStyle": "1",
                        "bdSize": "32"
                    }, "share": {}
                };
                with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=0.js?cdnversion=' + ~(-new Date() / 36e5)];
            </script>
        </div>
        <div class="col-md-2"></div>
    </div>
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-8">
            <div class="reply">
                <input type="hidden" value="-1" class="discussionId">
                <div class="replying">
                    <textarea class="form-control performContent" rows="5" style="resize: none;"></textarea>
                    <div class="btn btn-success performReply">回复</div>
                </div>


                <div class="panel panel-info">
                    <div class="panel-body">
                        最新回复
                    </div>
                </div>
                <div class="replies">
                    <img src="/images/loading@3x.gif" alt="">
                </div>
            </div>
        </div>
        <div class="col-md-2"></div>
    </div>
</div>

<script src="/js/discussionItem.js"></script>
</body>
<script>
    let discussionId = location.href.split("/");
    discussionId = discussionId[discussionId.length - 1];
    $.ajax({
        url: "/discussion/" + discussionId,
        type: "POST",
        dataType: "json",
        contentType: "application/json;charset=utf-8",
        success: function (response) {
            console.log(response);
            appendingDiscussion(response.data);
            appendingAuthor(response.data.user);
        },
        error: function (error) {
            console.log(error);
        }
    });
</script>
<script src="/js/common.js"></script>
<script>authenticate()</script>
<script>
    $(".performReply").click(function () {
        let content = $(".performContent").val();
        if (content == null || content.trim() === "") {
            alert("回复内容不能为空！！");
            return;
        }
        let type = 1;
        let targetId = location.href.split("/").pop();
        let userCommented = $(".DIUserId").val();
        reply(1, targetId, content,userCommented);
    });
</script>

<script>
    comments();
</script>

<script type="application/javascript" src="/js/editormd.min.js" defer="defer"></script>
<script type="application/javascript" src="/js/lib/marked.min.js" defer="defer"></script>
<script type="application/javascript" src="/js/lib/prettify.min.js" defer="defer"></script>
<link rel="stylesheet" href="/css/editormd.preview.min.css">
</html>